OsPath conversion
authorJoey Hess <joeyh@joeyh.name>
Mon, 10 Feb 2025 19:24:28 +0000 (15:24 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 10 Feb 2025 19:24:28 +0000 (15:24 -0400)
commitf1ba21d698c908ad84c08bce24fbbc376190fe83
tree2acbcc9fd13e83b3b2773f9799923e3f4902aa6d
parentd46504e51e01c956a0ebdc993b7c05d045c6f340
OsPath conversion

While some RawFilePath and FilePath remain, this converts most of
git-annex to using OsPath.

(When built without the OsPath build flag, is falls back to using
type OsPath = RawFilePath.)

The goals are
1) improved performance by using OsPath end-to-end when possible
2) potentially avoiding memory use problems caused by pinned strict
   ByteString, since OsPath uses ShortByteString
3) eventually eliminating the filepath-bytestring dependency so I don't
   need to keep maintaining that library
   (this doesn't get all the way, but close)
4) generally improved type safety, since OsPath is a newtype, while
   FilePath and RawFilePath are just type aliaes.

This is the result of a type checker driven process. I started by
converting from System.Directory to System.Directory.OsPath, and from
System.FilePath to System.OsPath. Then I fixed all the compile errors,
which took 3 weeks of work.

Unfortunately, there are several test suite failures at this point.
Also, it only has been built on linux, on windows and OSX there are
probably ifdefs whose code still needs to be converted.

Note that there is a parallel line of commits, starting with
05bdce328d890cbac68a8627aaae262078a8290a
which is the incremental progress as I worked on this. It will be merged
with this commit. In some cases, commits in that line explain in more
details the reasons for some specific changes.
369 files changed:
Annex.hs
Annex/AdjustedBranch.hs
Annex/AdjustedBranch/Merge.hs
Annex/AutoMerge.hs
Annex/Branch.hs
Annex/BranchState.hs
Annex/CatFile.hs
Annex/ChangedRefs.hs
Annex/CheckAttr.hs
Annex/CheckIgnore.hs
Annex/Content.hs
Annex/Content/LowLevel.hs
Annex/Content/PointerFile.hs
Annex/Content/Presence.hs
Annex/Content/Presence/LowLevel.hs
Annex/CopyFile.hs
Annex/DirHashes.hs
Annex/Drop.hs
Annex/ExternalAddonProcess.hs
Annex/FileMatcher.hs
Annex/Fixup.hs
Annex/GitOverlay.hs
Annex/HashObject.hs
Annex/Hook.hs
Annex/Import.hs
Annex/Ingest.hs
Annex/Init.hs
Annex/InodeSentinal.hs
Annex/Journal.hs
Annex/Link.hs
Annex/Locations.hs
Annex/LockFile.hs
Annex/Magic.hs
Annex/MetaData.hs
Annex/Multicast.hs
Annex/NumCopies.hs
Annex/Path.hs
Annex/Perms.hs
Annex/Proxy.hs
Annex/Queue.hs
Annex/ReplaceFile.hs
Annex/RepoSize/LiveUpdate.hs
Annex/Sim.hs
Annex/Ssh.hs
Annex/Tmp.hs
Annex/Transfer.hs
Annex/TransferrerPool.hs
Annex/Url.hs
Annex/VariantFile.hs
Annex/Verify.hs
Annex/View.hs
Annex/View/ViewedFile.hs
Annex/WorkTree.hs
Annex/YoutubeDl.hs
Assistant.hs
Assistant/Alert.hs
Assistant/Changes.hs
Assistant/Install.hs
Assistant/Install/AutoStart.hs
Assistant/Install/Menu.hs
Assistant/MakeRepo.hs
Assistant/Pairing/MakeRemote.hs
Assistant/Repair.hs
Assistant/Restart.hs
Assistant/Ssh.hs
Assistant/Threads/Committer.hs
Assistant/Threads/ConfigMonitor.hs
Assistant/Threads/Cronner.hs
Assistant/Threads/Merger.hs
Assistant/Threads/MountWatcher.hs
Assistant/Threads/PairListener.hs
Assistant/Threads/RemoteControl.hs
Assistant/Threads/SanityChecker.hs
Assistant/Threads/TransferWatcher.hs
Assistant/Threads/UpgradeWatcher.hs
Assistant/Threads/Watcher.hs
Assistant/Threads/WebApp.hs
Assistant/TransferSlots.hs
Assistant/Types/Changes.hs
Assistant/Unused.hs
Assistant/Upgrade.hs
Assistant/WebApp/Configurators/Delete.hs
Assistant/WebApp/Configurators/Edit.hs
Assistant/WebApp/Configurators/Local.hs
Assistant/WebApp/Configurators/Pairing.hs
Assistant/WebApp/Configurators/Preferences.hs
Assistant/WebApp/Configurators/Ssh.hs
Assistant/WebApp/Configurators/Unused.hs
Assistant/WebApp/Control.hs
Assistant/WebApp/DashBoard.hs
Assistant/WebApp/Documentation.hs
Assistant/WebApp/OtherRepos.hs
Backend.hs
Backend/External.hs
Backend/GitRemoteAnnex.hs
Backend/Hash.hs
Backend/Utilities.hs
Backend/VURL/Utilities.hs
Backend/WORM.hs
Build/Configure.hs
Build/DesktopFile.hs
Build/LinuxMkLibs.hs
Build/Standalone.hs
Build/TestConfig.hs
Build/Version.hs
CmdLine.hs
CmdLine/Batch.hs
CmdLine/GitAnnexShell.hs
CmdLine/GitAnnexShell/Checks.hs
CmdLine/GitRemoteAnnex.hs
CmdLine/Seek.hs
Command.hs
Command/Add.hs
Command/AddUnused.hs
Command/AddUrl.hs
Command/Assist.hs
Command/Assistant.hs
Command/CalcKey.hs
Command/Config.hs
Command/ContentLocation.hs
Command/Copy.hs
Command/DiffDriver.hs
Command/Drop.hs
Command/DropUnused.hs
Command/EnableTor.hs
Command/ExamineKey.hs
Command/Export.hs
Command/FilterBranch.hs
Command/FilterProcess.hs
Command/Find.hs
Command/Fix.hs
Command/FromKey.hs
Command/Fsck.hs
Command/FuzzTest.hs
Command/Get.hs
Command/Import.hs
Command/ImportFeed.hs
Command/Info.hs
Command/Inprogress.hs
Command/List.hs
Command/Lock.hs
Command/Log.hs
Command/LookupKey.hs
Command/Map.hs
Command/MatchExpression.hs
Command/MetaData.hs
Command/Migrate.hs
Command/Mirror.hs
Command/Move.hs
Command/Multicast.hs
Command/P2P.hs
Command/P2PHttp.hs
Command/PostReceive.hs
Command/PreCommit.hs
Command/ReKey.hs
Command/RecvKey.hs
Command/Reinject.hs
Command/RemoteDaemon.hs
Command/Repair.hs
Command/ResolveMerge.hs
Command/RmUrl.hs
Command/SendKey.hs
Command/SetKey.hs
Command/Sim.hs
Command/Smudge.hs
Command/Status.hs
Command/Sync.hs
Command/TestRemote.hs
Command/TransferKey.hs
Command/TransferKeys.hs
Command/Transferrer.hs
Command/Unannex.hs
Command/Undo.hs
Command/Uninit.hs
Command/Unlock.hs
Command/Unused.hs
Command/Vicfg.hs
Command/View.hs
Command/WebApp.hs
Command/WhereUsed.hs
Command/Whereis.hs
Common.hs
Config.hs
Config/Files.hs
Config/Files/AutoStart.hs
Config/Smudge.hs
Creds.hs
Crypto.hs
Database/Benchmark.hs
Database/ContentIdentifier.hs
Database/Export.hs
Database/Fsck.hs
Database/Handle.hs
Database/ImportFeed.hs
Database/Init.hs
Database/Keys.hs
Database/Keys/SQL.hs
Database/Queue.hs
Database/RepoSize.hs
Git.hs
Git/CatFile.hs
Git/CheckAttr.hs
Git/CheckIgnore.hs
Git/Command.hs
Git/Config.hs
Git/Construct.hs
Git/CurrentRepo.hs
Git/DiffTree.hs
Git/Env.hs
Git/FilePath.hs
Git/FilterProcess.hs
Git/HashObject.hs
Git/Hook.hs
Git/Index.hs
Git/LockFile.hs
Git/Log.hs
Git/LsFiles.hs
Git/LsTree.hs
Git/Objects.hs
Git/Queue.hs
Git/Quote.hs
Git/Ref.hs
Git/Repair.hs
Git/Status.hs
Git/Tree.hs
Git/Types.hs
Git/UnionMerge.hs
Git/UpdateIndex.hs
Key.hs
Limit.hs
Logs.hs
Logs/Export.hs
Logs/File.hs
Logs/FsckResults.hs
Logs/Location.hs
Logs/MetaData.hs
Logs/Migrate.hs
Logs/PreferredContent/Raw.hs
Logs/Presence.hs
Logs/Restage.hs
Logs/Schedule.hs
Logs/SingleValue.hs
Logs/Smudge.hs
Logs/Transfer.hs
Logs/Transitions.hs
Logs/Unused.hs
Logs/Upgrade.hs
Logs/View.hs
Messages.hs
Messages/JSON.hs
Messages/Progress.hs
P2P/Address.hs
P2P/Annex.hs
P2P/Auth.hs
P2P/Http/Client.hs
P2P/Http/Types.hs
P2P/IO.hs
P2P/Protocol.hs
Remote/Adb.hs
Remote/BitTorrent.hs
Remote/Borg.hs
Remote/Bup.hs
Remote/Ddar.hs
Remote/Directory.hs
Remote/Directory/LegacyChunked.hs
Remote/External.hs
Remote/External/Types.hs
Remote/GCrypt.hs
Remote/Git.hs
Remote/GitLFS.hs
Remote/Glacier.hs
Remote/Helper/AWS.hs
Remote/Helper/Chunked.hs
Remote/Helper/Chunked/Legacy.hs
Remote/Helper/Git.hs
Remote/Helper/Hooks.hs
Remote/Helper/Http.hs
Remote/Helper/P2P.hs
Remote/Helper/Path.hs
Remote/Helper/ReadOnly.hs
Remote/Helper/Special.hs
Remote/Helper/Ssh.hs
Remote/Helper/ThirdPartyPopulated.hs
Remote/Hook.hs
Remote/HttpAlso.hs
Remote/Rsync.hs
Remote/Rsync/RsyncUrl.hs
Remote/S3.hs
Remote/Tahoe.hs
Remote/Web.hs
Remote/WebDAV.hs
Remote/WebDAV/DavLocation.hs
RemoteDaemon/Transport/Tor.hs
Test.hs
Test/Framework.hs
Types/ActionItem.hs
Types/Backend.hs
Types/BranchState.hs
Types/Direction.hs
Types/Export.hs
Types/FileMatcher.hs
Types/GitConfig.hs
Types/Import.hs
Types/Key.hs
Types/KeySource.hs
Types/LockCache.hs
Types/Remote.hs
Types/StoreRetrieve.hs
Types/Transfer.hs
Types/Transferrer.hs
Types/Transitions.hs
Types/UUID.hs
Types/UrlContents.hs
Upgrade.hs
Upgrade/V0.hs
Upgrade/V1.hs
Upgrade/V2.hs
Upgrade/V5.hs
Upgrade/V5/Direct.hs
Upgrade/V7.hs
Upgrade/V9.hs
Utility/Aeson.hs
Utility/CopyFile.hs
Utility/Daemon.hs
Utility/DirWatcher.hs
Utility/DirWatcher/FSEvents.hs
Utility/DirWatcher/INotify.hs
Utility/DirWatcher/Types.hs
Utility/DirWatcher/Win32Notify.hs
Utility/Directory.hs
Utility/Directory/Create.hs
Utility/Directory/Stream.hs
Utility/FileIO.hs
Utility/FileMode.hs
Utility/FileSize.hs
Utility/FileSystemEncoding.hs
Utility/FreeDesktop.hs
Utility/Gpg.hs
Utility/HtmlDetect.hs
Utility/InodeCache.hs
Utility/LinuxMkLibs.hs
Utility/LockFile/PidLock.hs
Utility/LockFile/Posix.hs
Utility/LockFile/Windows.hs
Utility/LockPool/STM.hs
Utility/LogFile.hs
Utility/Lsof.hs
Utility/Metered.hs
Utility/MoveFile.hs
Utility/OSX.hs
Utility/OsPath.hs
Utility/OsString.hs [new file with mode: 0644]
Utility/Path.hs
Utility/Path/AbsRel.hs
Utility/Path/Tests.hs
Utility/Path/Windows.hs
Utility/RawFilePath.hs
Utility/SafeOutput.hs
Utility/Shell.hs
Utility/SshConfig.hs
Utility/StatelessOpenPGP.hs
Utility/Su.hs
Utility/SystemDirectory.hs
Utility/Tmp.hs
Utility/Tmp/Dir.hs
Utility/Tor.hs
Utility/Url.hs
Utility/WebApp.hs
git-annex.cabal